home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 9742 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  3.8 KB

  1. Path: galaxy.ucr.edu!not-for-mail
  2. From: thp@cs.ucr.edu (Tom Payne)
  3. Newsgroups: comp.lang.ada,comp.lang.c,comp.lang.c++
  4. Subject: Re: C/C++ knocks the crap out of Ada
  5. Followup-To: comp.lang.ada,comp.lang.c,comp.lang.c++
  6. Date: 4 Mar 1996 04:55:38 GMT
  7. Organization: University of California, Riverside
  8. Message-ID: <4hdt4a$ag9@galaxy.ucr.edu>
  9. References: <00001a73+00002504@msn.com> <4etcmm$lpd@nova.dimensional.com>   <312515DF.7D3B@cmlj.demon.co.uk> <4gad29$ddp@druid.borland.com> <4gl72q$mo9@galaxy.ucr.edu> <4h1vt6$eks@druid.borland.com>
  10. NNTP-Posting-Host: corvette.ucr.edu
  11. X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
  12.  
  13.  
  14. Pete Becker writes:
  15. >
  16. > In article <4gl72q$mo9@galaxy.ucr.edu>, thp@cs.ucr.edu says...
  17. > [...]
  18. > >We are talking about a language whose
  19. > >syntax is so convoluted that, Dan Saks devoted over a hundred column
  20. > >inches of the January issue of C/C++ Users Journal to telling
  21. > >professional C/C++ programmers how to parse declarations.  In the same
  22. > >issue, Pete Becker devoted space to explaining the meaning of
  23. > >sizeof(Sample&), which reads, "the number of bytes in the object
  24. > >representation for the type reference-to-Sample."  That value turns
  25. > >out to be (get this!) the number of bytes used to encode objects of
  26. > >type Sample, regardless of the number of bytes used to encode
  27. > >references --- a design decision so obscure and irregular that even
  28. > >the authors of the April Draft of the C++ standard missed it.
  29. > Yes, languages need to be explained, and sometimes have subtle points. 
  30.  
  31. I take some exception to this use of the word "subtle."  If wRef is a
  32. Widget reference whose referent is w, then the subexpression wRef in
  33. the expression sizeof(wRef) denotes w, which is a Widget.  So,
  34. technically, it is impossible to apply sizeof to an expression of type
  35. Widget reference, since such an expression spontaneously converts to
  36. type Widget when it is the arguement of sizeof, e.g., sizeof(wRef) IS
  37. sizeof(w).  But, in the expression sizeof(Widget&), the subexpression
  38. Widget& does not denote Widget, so it is astonishing that
  39. sizeof(Widget&) should turn out to be sizeof(Widget) even when the
  40. object representations for the two types are quite different.
  41.  
  42. Generally, the most natural extension of a concept is the one that
  43. requires the fewest changes to the wording of its definition,
  44. preferrably none.  In this case, C++ violates that principle, yielding
  45. an anomalie that is bizarre, rather than "subtle."
  46.  
  47. > That does not make any particular language "write only".
  48.  
  49. The "write-only" epithet is obvious hyperbole; with sufficient
  50. practice, intelligent people can read almost anything (e.g., Hollerith
  51. codes and van Wjingaarden grammars) --- the issue is how much practice
  52. it takes.  Some unfortunate design decisions have made C/C++
  53. considerably more difficult to read than necessary and, specifically,
  54. more difficult than Pascal, Modula, and Ada.  The C/C++ Users Journal
  55. article by Dan Saks was both well-written and helpful.  A similar
  56. article reviewing the basic syntax of type-forming expressions for a
  57. language with less convolute syntax would almost surely be viewed as
  58. unhelpful by similarly experienced programmers of that language.
  59.  
  60. > >P.S. My students say that C is an in-joke that everyone now knows,
  61. > >while C++ is a shaggy dog whose punch line is STL.
  62. > I would hope that you are teaching them critical analysis rather than analysis 
  63. > by one-liners. Unfortunately, context-free assertions about the complexity of 
  64. > C++ are not a useful base for a serious analysis. What are the alternatives, 
  65. > and what, objectively, are the critical needs that those alternatives do not 
  66. > answer?
  67.  
  68. We try!  Actually, the one-liners are a glib way of expressing
  69. judgments, not of arriving at them.  C and C++ are the languages of
  70. choice for these students.  Their exposure to Ada is mostly through
  71. its VHDL derivative, which is used heavily in our hardware courses.
  72.  
  73. Tom Payne (thp@cs.ucr.edu)
  74.